public class Person {
	protected String name;
	protected String surname;
	protected int age;
	protected String phone;

	public Person(String name, String surname, int age, String phone) {
		this.name = name;
		this.surname = surname;
		this.age = age;
		this.phone = phone;
	}

	public String getName() {
		return name;
	}

	public String getSurname() {
		return surname;
	}

	public int getAge() {
		return age;
	}

	public String getPhone() {
		return phone;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (this == obj) {
			return true;
		}
		if (this.getClass() == obj.getClass()) {
			Person person = (Person) obj;
			if ((person.name.equals(name)) && (person.surname.equals(surname))
					&& (person.age == age) && (person.phone.equals(phone))) {
				return true;
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		int hash = 1;
		hash = hash * 17 + (int) age;
		hash = 17 * hash + name.hashCode();
		hash = 17 * hash + surname.hashCode();
		hash = 17 * hash + phone.hashCode();
		return hash;
	}

	@Override
	public String toString() {
		String s = "";
		s += name + surname + age + phone;
		return s;
	}

	public boolean matchByName(String name) {
		return this.name.equals(name);
	}

	public boolean matchBySurname(String surname) {
		return this.surname.equals(surname);
	}

	public boolean matchByAge(int age) {
		return this.age == age;
	}

	public boolean matchByPhone(String phone) {
		return this.phone.equals(phone);
	}
}
